package com.cj.rxdo;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

/**
 * Created by cj on 2017/3/22.
 */

public class VideoLayout extends LinearLayout{
    private String title="中文药水";
    private TextView tv_title;
    public VideoLayout(Context context) {
        this(context,null);
    }

    public VideoLayout(Context context, @Nullable AttributeSet attrs) {
        this(context,attrs,0);
    }

    public VideoLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);

        initView(context);
    }

    private void initView(Context context) {
        View view= LayoutInflater.from(context).inflate(R.layout.item_longevity,null);
        removeAllViews();
        ViewGroup.LayoutParams lp=new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        view.setLayoutParams(lp);
        addView(view);
        tv_title=(TextView) findViewById(R.id.txt_video_title);
        tv_title.setText(title);
    }
}
